#!/bin/bash
echo -e "{\"data\":["

# we have to end each line with a comma except the last one (JSON SIC!)
# so we have to manage the line separator manually in awk :/
egrep -v 'major|^$|dm-|[0-9]$' /proc/partitions | awk '
  BEGIN{ORS="";n=0}
  {
    if (n++) print ",\n";
    print "{\"{#DEVNAME}\":\""$4"\"}"
  }
'
echo -e "]}"
